﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Doan_ver1
{
    public partial class WebForm4 : System.Web.UI.Page
    {
        public string connection()
        {
            return Provider.connectionString();
        }
        public void loadThongTin()
        {
          //  String connectionString = "Data Source=RICARDOQUI-PC;Initial Catalog=NGANHANG;Integrated Security=SSPI";
        SQLNganHangDataContext data = new SQLNganHangDataContext(connection());
            TaiKhoan taiKhoan = data.TaiKhoans.Where(c => c.TenDangNhap == Session["khachhang"] as string).FirstOrDefault();
            tbHoTen.Text = taiKhoan.HoVaTen;
            tbemail.Text = taiKhoan.Email;
            tbusername.Text = taiKhoan.TenDangNhap;
            tbCMND.Text = taiKhoan.CMND;
        }
        protected void Page_Load(object sender, EventArgs e)
        {

            if (Session["khachhang"] == null)
                Response.Redirect("DangNhap.aspx");
            if (!IsPostBack)
                loadThongTin();
        }
      

    
       
        protected void Button1_Click(object sender, EventArgs e)
        {

            // String connectionString = "Data Source=RICARDOQUI-PC;Initial Catalog=NGANHANG;Integrated Security=SSPI";
                SQLNganHangDataContext data = new SQLNganHangDataContext(connection());
             TaiKhoan tk =  data.TaiKhoans.Single(c => c.TenDangNhap == Session["khachhang"] as string);

             tk.HoVaTen = tbHoTen.Text;
            tk.CMND = tbCMND.Text;
                data.SubmitChanges();

         
        }

        protected void tbHoTen_TextChanged(object sender, EventArgs e)
        {
           
        }

        
    }
}